package com.cardone.platform.authority.service;

import java.util.List;

import lombok.Getter;
import lombok.Setter;

import com.cardone.common.dto.PaginationDto;
import com.cardone.context.ContextHolder;
import com.cardone.platform.authority.dao.RolePermissionDao;
import com.cardone.platform.authority.dto.RolePermissionDto;

/**
 * 角色与许可服务
 *
 * @author yaohaitao
 *
 */
@Getter
@Setter
public class RolePermissionDefaultService implements RolePermissionService {
	@Override
	public int deleteByIds(final RolePermissionDto deleteRolePermission) {
		return ContextHolder.getBean(RolePermissionDao.class).deleteByIds(deleteRolePermission);
	}

	@Override
	public <P> P findByCodeOrId(final Class<P> mappedClass, final RolePermissionDto findRolePermission) {
		return ContextHolder.getBean(RolePermissionDao.class).findByCodeOrId(mappedClass, findRolePermission);
	}

	@Override
	public <P> P findById(final Class<P> mappedClass, final RolePermissionDto findRolePermission) {
		return ContextHolder.getBean(RolePermissionDao.class).findById(mappedClass, findRolePermission);
	}

	@Override
	public <P> List<P> findListByLikeCode(final Class<P> mappedClass, final RolePermissionDto findListRolePermission) {
		return ContextHolder.getBean(RolePermissionDao.class).findListByLikeCode(mappedClass, findListRolePermission);
	}

	@Override
	public int insertByCode(final RolePermissionDto insertRolePermission) {
		return ContextHolder.getBean(RolePermissionDao.class).insertByCode(insertRolePermission);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(final Class<P> mappedClass, final RolePermissionDto paginationRolePermission) {
		return ContextHolder.getBean(RolePermissionDao.class).paginationByLikeCode(mappedClass, paginationRolePermission);
	}

	@Override
	public Integer readByCodeNqIdForCount(final RolePermissionDto readRolePermission) {
		return ContextHolder.getBean(RolePermissionDao.class).readByCodeNqIdForCount(readRolePermission);
	}

	@Override
	public <P> P saveByIdOrCode(final Class<P> mappedClass, final RolePermissionDto saveRolePermission) {
		return ContextHolder.getBean(RolePermissionDao.class).saveByIdOrCode(mappedClass, saveRolePermission);
	}

	@Override
	public int updateByCode(final RolePermissionDto updateRolePermission) {
		return ContextHolder.getBean(RolePermissionDao.class).updateByCode(updateRolePermission);
	}
}